﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Microsoft.Samples.Office.UnifiedCommunications.Gadget"
    x:Class="Microsoft.Samples.Office.UnifiedCommunications.Gadget.EWSConfig"
    Title="Exchange Web Services Configuration"
    ShowsNavigationUI="False" 
    ClipToBounds="True"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    
    <Page.Resources>
        <Storyboard x:Key="LoadAni">
            <local:BackDoubleAnimation Completed="BackDoubleAnimation_Completed" From="300" To="0" Duration="0:0:0.8" EdgeBehavior="EaseOut" Amplitude=".5"   Suppression="0" DecelerationRatio=".5" Storyboard.TargetName="mainGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.X)"/>
        </Storyboard>
    	<Storyboard x:Key="modal">
    		<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="mainGrid" Storyboard.TargetProperty="(UIElement.Opacity)">
    			<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.25" KeySpline="1,0,1,1"/>
    		</DoubleAnimationUsingKeyFrames>
    	</Storyboard>
    </Page.Resources>
    <Page.Triggers>
        <EventTrigger RoutedEvent="FrameworkElement.Loaded">
            <BeginStoryboard Storyboard="{StaticResource LoadAni}"/>
        </EventTrigger>
    </Page.Triggers>
    <Grid x:Name="mainGrid">
        <Grid.RenderTransform>
            <TranslateTransform X="0" Y="0"/>
        </Grid.RenderTransform>
        <Border BorderThickness="1,1,1,1" BorderBrush="#FF333945" CornerRadius="9,9,9,9">
            <Border Width="Auto" Height="Auto" BorderBrush="#FF161D25" BorderThickness="1,1,1,1" CornerRadius="8,8,8,8">
                <Grid Width="Auto" Height="Auto" x:Name="ContentGrid">
                    <Rectangle Stroke="{x:Null}" RadiusX="8" RadiusY="8" Width="Auto" Height="Auto">
                        <Rectangle.Fill>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFDAE3EF" Offset="0"/>
                                <GradientStop Color="#FFE2EBF1" Offset="1"/>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Text="Exchange Web Services Configuration" TextWrapping="Wrap" FontFamily="Calibri" FontSize="16" FontWeight="Bold" Foreground="#FF3D4F73" Margin="0,10,0,0"/>
                    <StackPanel Orientation="Vertical" x:Name="spEWSConfig" d:LayoutOverrides="Height" Margin="10,55,10,0">
                    	<StackPanel.Resources>                                   
                    		<Style x:Key="ValidationStyle">
                    			<Setter Property="Control.BorderBrush" Value="Red"/>
                    			<Setter Property="Control.BorderThickness" Value="2"/>                                        
                    		</Style>
                    	</StackPanel.Resources>
                    	
                        <StackPanel x:Name="spServer" Visibility="Collapsed">
                    		<TextBlock>
                                <Run Text="Server name: "/>
                                <InlineUIContainer>
            				        <TextBlock FontStyle="Italic"><Run Text="e.g. exch1.contoso.com"/></TextBlock>
            			        </InlineUIContainer>
                            </TextBlock>
                    		<TextBox x:Name="txtServer" Style="{DynamicResource textBoxstyle1}" TabIndex="0"/>
                    	</StackPanel>
                    	
                        <StackPanel x:Name="spEmailAddress" Visibility="Visible">
                    		<TextBlock ><Run Text="Email address:"/></TextBlock>
                    		<TextBox  x:Name="txtEmailAddress" Style="{DynamicResource textBoxstyle1}" TabIndex="1"/>
                    	</StackPanel>
                    	
                        <StackPanel Width="Auto" Height="Auto" Margin="0,10,0,0" Background="{x:Null}">
                    		<TextBlock Width="Auto" Height="Auto"><Run Text="Domain name: "/>
                                <InlineUIContainer>
                    		        <TextBlock FontStyle="Italic"><Run Text="e.g. contoso"/></TextBlock>
                    		    </InlineUIContainer>
                            </TextBlock>
                    		<TextBox x:Name="txtDomain" Width="Auto" Height="Auto" Style="{DynamicResource textBoxstyle1}" TabIndex="2"/>
                    	</StackPanel>
                    	
                        <StackPanel Width="Auto" Height="Auto" Margin="0,10,0,0">
                    		<TextBlock Width="Auto" Height="Auto"><Run Text="User name:"/></TextBlock>
                    		<TextBox x:Name="txtUserName" Width="Auto" Height="Auto" Style="{DynamicResource textBoxstyle1}" TabIndex="3"/>
                        </StackPanel>
                    	
                        <StackPanel Width="Auto" Height="Auto" Margin="0,10,0,0">
                    		<TextBlock Width="Auto" Height="Auto"><Run Text="Password:"/></TextBlock>
                    		<PasswordBox x:Name="txtPassword" Width="Auto" Height="Auto" PreviewKeyUp="EWSForm_PreviewKeyUp" TabIndex="4"/>
                    	</StackPanel>
                    	
                        <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                    		<CheckBox x:Name="chkAutoDiscover" Unchecked="chkAutoDiscover_Unchecked" Checked="chkAutoDiscover_Checked" VerticalAlignment="Center" HorizontalAlignment="Left"/>
                    		<TextBlock VerticalAlignment="Center" Margin="5,0,0,0" ><Run Text="Automatically determine my settings"/></TextBlock>
                    	</StackPanel>
                        
                        <Grid x:Name="gridLoading" Visibility="Hidden" Width="Auto" Margin="0,20,0,0">
                    		<Rectangle HorizontalAlignment="Stretch" Width="Auto" Fill="#70FB350B" Stroke="{x:Null}" Margin="75,0,75,0" RadiusX="4" RadiusY="4"/>
                    		<Label Content="Loading ..." FontFamily="Calibri" FontSize="14" Foreground="#FFFFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    	</Grid>
                        
                        <Grid x:Name="gridMessage" Visibility="Collapsed" Margin="0,20,0,0">
                            <Border BorderBrush="#70FB350B" Background="#70FB350B" CornerRadius="2" Width="200" 
                                    BorderThickness="1" Padding="0" VerticalAlignment="Center" HorizontalAlignment="Center">
                		        <TextBlock x:Name="tbMessage" FontFamily="Calibri" FontSize="14" 
                                   Foreground="#FFFFFFFF" HorizontalAlignment="Center" Margin="0,0,0,0"
                                   VerticalAlignment="Center" TextWrapping="Wrap" />
                            </Border>
                        </Grid>
                    </StackPanel>

                    <Button x:Name="btnApply" Click="btnApply_Click" VerticalAlignment="Bottom" Content="Apply" Style="{DynamicResource BtnGeneric}" Width="60" Height="20" TabIndex="5" Margin="0,0,0,10"/>
                    <Button x:Name="btnCancel" Click="btnCancel_Click" HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Close" Style="{DynamicResource BtnGeneric}" Width="60" Height="20" TabIndex="6" Margin="10,0,50,10"/>
                    <Button Template="{DynamicResource ImageButton}" Height="29" Width="29" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,10,5" x:Name="btnHelp">
                        <Image Width="29" Height="29" Source="Resources\Images\helpBtn.png" Stretch="Uniform" StretchDirection="DownOnly"/>
                    </Button>
                    <Grid x:Name="tooltip" Opacity="0" Width="250" Height="350" VerticalAlignment="Bottom" Visibility="Hidden"  HorizontalAlignment="Right" Margin="0,0,26,13">
                    	<Image Source="{StaticResource toolTip}" />                    		
                    	
                    	<TextBlock Foreground="#FFFFFF" FontSize="8.7pt" Margin="17,60,40,20" TextWrapping="Wrap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" TextAlignment="Left"><Run FontSize="9.3pt" Text="Exchange Web Services Configuration Instructions"/><LineBreak /><LineBreak /><Run Foreground="#9FFFFFFF" Text="The gadget connects to Exchange Web Services to retrieve your voicemail and frequency of email contact with people in your Top 5 list."/><LineBreak /><LineBreak /><Run Foreground="#9FFFFFFF" Text="Exchange Web Services is a component of Microsoft Exchange Server 2007."/></TextBlock>
                    </Grid>
    			</Grid>
            </Border>
        </Border>
    </Grid>
</Page>
